<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="hello">
        <span v-if="isPhone">
            <label for="phone">手机号码：</label> 
            <!-- key不同，vue底层不会进行组件的复用 -->
            <input type="text" placeholder="请输入手机号码" id="phone" key="phone"></span>
        <span v-else>
            邮箱号码: 
            <input type="text" placeholder="请输入邮箱账号" key = 'email'>
        </span>
        <button @click='changeIsPhone()'>切换登录方式</button>
    </div>
    <script src="../vue.js"></script>
    <script>
        const vue01 = new Vue({
            el: '#hello',
            data: {
               isPhone:true,
            },
            methods: {
                changeIsPhone(){
                  this.isPhone= !this.isPhone;
                }
            },

        })
    </script>
</body>

</html>